package org.myorg.v3;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapred.RecordReader;

public class DRecordReader implements RecordReader<IntWritable,IntWritable> {
	private int total = 0;
	private int seg = 0;
	boolean mark = true;
	
	
	public DRecordReader(int seg, int all) {
		this.seg = seg;
		total = all;
	}
	
	public boolean next(IntWritable key, IntWritable value)
	throws IOException {

		
		key.set(seg);
		value.set(total);
		

		if (mark) {
			mark = false;
			return true;
		} else
			return false;
	}
	
	public IntWritable createKey() { return new IntWritable(); }
	
	public IntWritable createValue() { return new IntWritable(); }
	
	public long getPos() throws IOException { return 1; }
	
	public void close() throws IOException { }
	
	public float getProgress() throws IOException {
		return 1;
	}

}
